home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
c
/
vbccwos.lha
/
vbcc
/
doc
/
vbcc.doc
< prev
next >
Wrap
Text File
|
1999-03-07
|
26KB
|
660 lines
vbcc - C compiler (c) in 1995-99 by Volker Barthelmann
vbpp - C preprocessor (c) in 1995-96 by Thorsten Schaaps
INTRODUCTION
vbcc is a free portable and retargetable ANSI C compiler.
It is split into a target-independant and a target-dependant part, and
supports emulating datatypes of the target machine on any other machine
so that it is possible to e.g. make a crosscompiler for a 64bit machine
on a 32bit machine.
The target-independant part generates a form of intermediate code
(quads) which has to be dealt with by the code generator. This
intermediate code is rather cpu independant (apart from register usage)
but the target-independant part of vbcc uses informations about the
target machine while generating this code.
If you are interested in writing a code generator for vbcc, contact
me (the necessary documents are not written yet).
This document only deals with the target-independant parts of vbcc.
Be sure to read all the documents for your machine.
LEGAL
vbcc is (c) in 1995-99 by Volker Barthelmann. The builtin preprocessor
(consisting of the files preproc.c and vbpp.h) is written and (c) by
Thorsten Schaaps. All other code is (c) by Volker Barthelmann.
vbcc may be freely redistributed as long as no modifications are made
and nothing is charged for it.
Non-commercial usage of vbcc is allowed without any restrictions.
Commercial usage needs my written consent.
Sending me money, gifts, postcards etc. would be very nice and may
encourage further development of vbcc, but is not legally or morally
necessary to use vbcc.
INSTALLATION
The installation is system dependant and covered in another manual.
USAGE
Usually vbcc will be called by a frontend. However, if you call it
directly it has to be done like this (and most of the options
should be passed through to vbcc by the frontend):
vbcc [options] file
The following options are supported by the machine independant part
of vbcc:
-quiet Do not print the copyright notice.
-ic1 Write the intermediate code before optimizing to file.ic1.
-ic2 Write the intermediate code after optimizing to file.ic2.
-debug=n Set the debug level to n.
-o=ofile Write the generated assembler output to <ofile> rather than
the default file.
-noasm Do not generate assembler output (only for testing).
-O=n Turns optimizing options on/off; every bit set in n turns
on an option.
(See section on optimizing.)
-maxoptpasses=n
Set maximum number of optimizer passes to n.
(See section on optimizing.)
-inline-size=n
Set the maximum 'size' of functions to be inlined.
(See section on optimizing.)
-unroll-size=n
Set the maximum 'size' of unrolled loops.
(See section on optimizing.)
-fp-associative
Floating point operations do not obey the law of
associativity, e.g. (a+b)+c==a+(b+c) is not true for all
floating point numbers a,b,c. Therefore certain optimizations
depending on this property cannot be performed on floating
point numbers.
With this option you can tell vbcc to treat floating point
operations as associative and perform those optimizations
even if that may change the results in some cases (not
ANSI conforming).
-no-alias-opt
If the optimizer is turned on, vbcc has to make assumptions
on aliasing (i.e. which pointer can point to which
objects at a given time). If this option is specified,
vbcc will make worst-case assumptions and some
non-conforming programs could be made to work that way.
-no-multiple-ccs
If the code generator supports multiple condition code
registers, vbcc will try to use them when optimizing.
This flag prevents vbcc from using them.
-iso
-ansi Switch to ANSI/ISO mode.
In ANSI mode warning 209 will be printed by default.
'__reg' and inline-assembly-functions are not recognized.
Also assignments between pointers to <type> and pointers
to unsigned <type> will cause warnings.
-maxerrors=n
Abort the compilation after n errors; do not stop if n==0.
-dontwarn=n
Suppress warning number n; suppress all warnings if n<0.
(See the section on errors/warnings.)
-warn=n
Turn on warning number n; turn on all warnings if n<0.
(See the section on errors/warnings.)
-strip-path
Strip the path of filenames in error messages.
Error messages may look more convenient to some people that
way, but using this together with message browsers or
similar programs could cause trouble.
-nested-comments
Allow nested comments (not ANSI conforming).
Has no effect if the builtin preprocessor is disabled.
-cpp-comments
Allow C++ style comments (not ANSI conforming).
Has no effect if the builtin preprocessor is disabled.
-macro-redefinition
Allow redefinition of macros (not ANSI conforming).
Has no effect if the builtin preprocessor is disabled.
-no-trigraphs
Prevents expansion of trigraphs (not ANSI conforming).
Has no effect if the builtin preprocessor is disabled.
-no-preprocessor
Do not invoke the builtin preprocessor vbpp.
-E Only preprocess the file and write the preprocessed
source to <file>.i.
-dontkeep-initialized-data
By default vbcc keeps all data of initializations in memory
during the whole compilation (it can sometimes make use
of this when optimizing). This can take some amount of
memory, though. If this option is specified, vbcc does not
keep this data in memory and uses less memory.
This has not yet been tested very well.
The assembler output will be saved to file.asm (if file already contained
a suffix, this will first be removed; same applies to .ic1/.ic2)
SOME INTERNALS
I try to make vbcc as ANSI compliant as possible, so I am only mentioning
some things I consider interesting.
ERRORS/WARNINGS
vbcc knows the following kinds of messages:
fatal errors Something is badly wrong and further compilation is
impossible or pointless. vbcc will abort.
E.g. no source file or really corrupt source.
errors There was an error and vbcc cannot generate useful
code. Compilation continues, but no code will be
generated.
E.g. unknown identifiers.
warnings (1) Warnings with ANSI-violations. The program is not
ANSI-conforming, but vbcc will generate code that
could be what you want (or not).
E.g. missing semicolon.
warnings (2) The code has no ANSI-violations, but contains some
strange things you should perhaps look at.
E.g. unused variables.
Errors or the first kind of warnings are always displayed and cannot
be suppressed.
Only some warnings of the second kind are turned on by default.
Many of them are very useful for some but annoying to others, and
their usability may depend on programming style. As I do not want
to force anyone to a certain style, I recommend everyone to find
their own preferences.
A good way to do this is starting with all warnings turned on by
-warn=-1. So you will see all possi